/**
 * Created by Seep on 2016/10/29.
 */
define([],function(){
  'use strict';
  var service = function($http,$q){
    return{
      postreq:function(url,data){
        var deferred = $q.defer();
        $http({
          method:'post',
          url:url,
          data:data,
          headers : { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8' }
        })
          .success(function(res){
            deferred.resolve(res);
          })
        return deferred.promise;
      },
      getreq:function(url){
        var deferred = $q.defer();
        $http.get(domain+url)
          .success(function(res){
            deferred.resolve(res);
          })
        return deferred.promise;
      }
    }

  }
  service.$inject = ['$http','$q'];
  return service;
})
